package com.wuxiaofan.member.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.member.entity.MemberLevel;
import com.wuxiaofan.member.entity.custom.MemberLevelCustom;
import com.wuxiaofan.member.mapper.MemberLevelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.member.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class MemberLevelService {
    @Autowired
    private MemberLevelMapper umsMemberLevelMapper;
    @Resource
    private Idgenerator idgenerator;
    public MemberLevel findById(String id){
        return umsMemberLevelMapper.selectById(id);
    }

    public MemberLevelCustom findCountByMap(Map paraMap){
        return umsMemberLevelMapper.findCountByMap(paraMap);
    }

    public MemberLevelCustom findGroupByMap(Map paraMap){
        return umsMemberLevelMapper.findGroupByMap(paraMap);
    }

    public List<MemberLevelCustom> findByMap(Map paraMap){
        return umsMemberLevelMapper.findByMap(paraMap);
    }

    public Page<MemberLevelCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(umsMemberLevelMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        umsMemberLevelMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        umsMemberLevelMapper.deleteById(id);
    }

    public MemberLevel save(MemberLevel umsMemberLevel){
        umsMemberLevel.setId(idgenerator.getId());
        umsMemberLevelMapper.insert(umsMemberLevel);
        return umsMemberLevel;
    }

}
